import { createRouter, createWebHashHistory } from 'vue-router'
import layout from '@/layout'

import reportedmanage from './modules/ReportedManage'
import sysmanage from './modules/SysManage'
import user from './modules/user'

/**
 * 私有路由表
 */
export const privateRoutes = [
  reportedmanage,
  sysmanage,
  user
]


/**
 *  公开路由表 
 */
const publicRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  {
    path: '/',
    component: layout,
    redirect: '/profile',
    children: [
      {
        path: '/profile',
        name: '个人中心',
        component: () =>import('@/views/profile'),
        mata: {
          title: '个人中心',
          icon: 'el-icon-user'
        }
      }
    ]
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error-page/404')
  },
  {
    path: '/401',
    name: '401',
    component: () => import('@/views/error-page/401')
  }
]


const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('@/layout/index')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: [...publicRoutes, ...privateRoutes]
})

export default router
